//url
function urls() {
    return "http://" + window.location.host;
}
var url = urls();

//tel
function tel() {
    return "4006-229-779";
}
var tel_number = tel();
//wx
function wechat() {
    return "15871680621";
}
var wx = wechat();
//截取url
function oneValues() {
    var query = location.search.substr(1)
    query = query.split('&')
    var params = {};
    for (let i = 0; i < query.length; i++) {
        let q = query[i].split('=')
        if (q.length === 2) {
            params[q[0]] = q[1]
        }
    }
    return params //返回?号后面的参数名与参数值的数组
};

// 时间转换
function timestampToTime(timestamp) {
    var date = new Date(timestamp * 1000); //时间戳为10位需*1000，时间戳为13位的话不需乘1000
    Y = date.getFullYear() + '-';
    M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '-';
    D = date.getDate() + ' ';
    h = date.getHours() + ':';
    m = date.getMinutes() + ':';
    s = date.getSeconds();
    if (date.getHours() < 10) {
        h = '0' + date.getHours() + ':';
    }
    if (date.getMinutes() < 10) {
        m = '0' + date.getMinutes() + ':';
    }
    if (date.getSeconds() < 10) {
        s = '0' + date.getSeconds();
    }
    return Y + M + D + h + m + s;

}

//range
function range(id) {
    window.location.href = url + "/portal/index/rangedetails?id=" + id;
}

//show
function show_wx() {
    $(".show").css("display", "block");
    $(".show_wx").css("display", "block");
}

function show_tel() {
    $(".show").css("display", "block");
    $(".show_tel").css("display", "block");
}

function show_hide() {
    $(".show").css("display", "none");
    $(".show_tel").css("display", "none");
}

$(function () {
    //wx
    $(".wechat").html(wx);
    //tel
    $(".tel_number").html(tel_number);
    //logo跳转
    $(".logo", ".header").click(function () {
        window.location.href = url;
    })

    //range
    $(".project_btn").click(function () {
        range($(this).attr("id"));
    })

    $(".range_details_list").click(function (e) {
        if (e.target.tagName == "P") {
            range($(e.target).attr("name"));
            // $("p", ".range_details_list").removeClass("list_active");
            // $(e.target).addClass("list_active");
            // $(".range_details").css("display", "none");
            // $("#" + $(e.target).attr("name")).css("display", "block");
        }
    });
})